package com.ai.ly.goodsautocat.util;

import java.util.List;

import com.huaban.analysis.jieba.JiebaSegmenter;
import com.huaban.analysis.jieba.SegToken;
import com.huaban.analysis.jieba.JiebaSegmenter.SegMode;

/**
 * 
 * Title: 结巴分词 <br>
 * Description: <br>
 * Date: 2018年3月22日 <br>
 * Copyright (c) 2018 AILK <br>
 * 
 * @author liangyi
 */
public class JiebaAnalysisUtil {
    
    private static JiebaSegmenter segmenter=new JiebaSegmenter();

    /**
     * 以SEARCH模式分词
     * 
     * @param sentence
     * @return
     * @author liangyi
     */
    public static List<SegToken> processInSearchMode(String sentence) {
        List<SegToken> resultList = segmenter.process(sentence, SegMode.SEARCH);
        return resultList;
    }

    /**
     * 以INDEX模式分词
     * 
     * @param sentence
     * @return
     * @author liangyi
     */
    public static List<SegToken> processInIndexMode(String sentence) {
        List<SegToken> resultList = segmenter.process(sentence, SegMode.INDEX);
        return resultList;
    }

}
